<template>
	<view class="flex-col page">
		<u-navbar title="公告详情" :autoBack="true" bgColor="#fff" placeholder="true"></u-navbar>
		<view class="mt-8 flex-col section">
			<text class="self-center text text_2 u-line-1">{{item.title}}</text>
			<text class="self-center text text_3 mt-15">时间：{{item.create_time}}</text>
			<view class="flex-col self-stretch mt-15">
				<u-parse :content="item.content" :copyLink="true" :selectable="true"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		props: {},
		data() {
			return {
				item: '',
			};
		},
		onLoad(options) {
			if(options.id){
				this.$api.sendRequest({
					url: '/api/index/getNewsInfo',
					data: {
						id: options.id,
					},
					success: res => {
						//console.log(res.data)
						if (res.code == 1) {
							this.item = res.data
							console.log(this.notice_list);
							this.item.content = this.item.content.split(/(<|\/><|><|\/>|>)/).map(item => {
								if (item.indexOf('img') >= 0) {
									return item + ' style="display: block;width: 100%;height:auto" '
								}
								return item;
							}).join('');
						}
					}
				});
			}else{
				this.item = uni.getStorageSync('newsDetail');
				this.item.content = this.item.content.split(/(<|\/><|><|\/>|>)/).map(item => {
					if (item.indexOf('img') >= 0) {
						return item + ' style="display: block;width: 100%;height:auto" '
					}
					return item;
				}).join('');
			}
			
		},
		methods: {},
	};
</script>

<style scoped lang="scss">
	.mt-15 {
		margin-top: 30rpx;
	}

	.page {
		background-color: #f5f5f5;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100%;

		.image-wrapper {
			padding: 34rpx 0 20rpx;
			background-color: #ffffff;

			.image {
				margin-left: 34rpx;
				margin-right: 8rpx;
				width: 94.4vw;
				height: 18.8vw;
			}
		}

		.section {
			margin: 0 10rpx;
			padding: 39rpx 28rpx 33rpx 31rpx;
			background-color: #ffffff;
			border-radius: 10rpx;

			.text {
				text-transform: uppercase;
			}

			.text_2 {
				color: #011613;
				font-size: 30rpx;
				font-family: PingFangSC;
				line-height: 30rpx;
			}

			.text_3 {
				color: #999999;
				font-size: 26rpx;
				font-family: PingFangSC;
				line-height: 26rpx;
			}

			.font {
				font-size: 24rpx;
				font-family: Adobe Heiti Std;
				line-height: 42rpx;
				color: #011613;
			}

			.image_2 {
				margin-right: 3rpx;
				margin-top: 29rpx;
				width: 666rpx;
				height: 210rpx;
			}

			.group {
				margin-top: 21rpx;

				.text_4 {
					color: #b01431;
				}
			}

			.image_3 {
				margin-right: 4rpx;
				margin-top: 23rpx;
				width: 666rpx;
				height: 339rpx;
			}

			.group_2 {
				margin-top: 20rpx;

				.text_5 {
					color: #011613;
					font-size: 28rpx;
					font-family: Adobe Heiti Std;
					line-height: 49rpx;
				}
			}
		}
	}
</style>